<?php


namespace app\api\validate;


use think\Validate;

class UserValidate extends Validate
{
    protected $rule=[
      'user_name' => 'requireIf:account_type,2|max:20',
      'school_name' => 'requireIf:account_type,2',
      'school_address' => 'requireIf:account_type,2',
      'mobile' => 'require|mobile|unique:user',
      'password' => 'require|min:6',
      'account_type' => 'require|in:1,2',
    ];
    protected $message=[
        'user_name.require'=>'请输入名字',
        'school_name.require'=>'请输入学校',
        'school_address.require'=>'请输入学校地址',
        'mobile.require'=>'请输入手机号',
        'mobile.max'=>'手机号最大11位',
        'mobile.min'=>'手机号格式不对',
        'password.require'=>'请输入密码',
        'password.min'=>'密码最少6位',
    ];
    protected $scene = [
        'registration' => ['user_name', 'school_name', 'school_address', 'mobile','password']
    ];

}